<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    div{
      width: 400px;
      height: 400px;
      border: 1px solid red;
      margin: 0 auto;
    }
    img{
      width: 50px;
      height: 50px;
    }
    img.one{

    }
    img.two{
      vertical-align: text-top;
      /*只试用于文本*/
    }
    img.three{
      vertical-align: text-bottom;
    }
    img.four{
      vertical-align: middle;
    }
    .p-2{
      width: 200px;
      height: 200px;
      background: deeppink;
    }
    .p-2 img{
      margin: 0;
      padding: 0;
      vertical-align: middle;
    }
  </style>
</head>
<body>
  <div>
    <p>一个<img class="one" src="img/4.jpg" alt="">默认对齐的图像</p>
    <p>一个<img class="two" src="img/4.jpg" alt="">text-top对齐的图像</p>
    <p>一个<img class="three" src="img/4.jpg" alt="">text-bottom对齐的图像</p>
    <p>一个<img class="four" src="img/4.jpg" alt="">middle对齐的图像</p>
  </div>
  <p class="p-2">
    <img src="img/5.jpg" alt="" />
  </p>
</body>
</html>
